<template>
  <div :id="`anchor-basic-${exam.questNum}`">
    <template v-if="exam.typeId === 2">
      <!-- 单选题 -->
      <Radio :examList="examList" :exam="exam" @handleExam="handleExam" />
    </template>

    <template v-else-if="exam.typeId === 3">
      <!-- 多选题 -->
      <Check :examList="examList" :exam="exam" @handleExam="handleExam" />
    </template>

    <template v-else-if="exam.typeId === 4">
      <!-- 下拉选择题 -->
      <DropSelect :examList="examList" :exam="exam" @handleExam="handleExam" />
    </template>

    <template v-else-if="exam.typeId === 6">
      <!-- 填空题 -->
      <Pack :examList="examList" :exam="exam" @handleExam="handleExam" />
    </template>
  </div>
</template>
<script lang="ts">
import { ExamItem } from '@/store/design/types';
import Check from '@/components/type-of-exam/Check.vue';
import Radio from '@/components/type-of-exam/Radio.vue';
import DropSelect from '@/components/type-of-exam/DropSelect.vue';
import Pack from '@/components/type-of-exam/Pack.vue';
import { defineComponent } from 'vue';
export default defineComponent({
  components: { Radio, Check, DropSelect, Pack },
  props: {
    exam: { type: ExamItem, required: true },
    /** 题目列表 */
    examList: { type: Array, default: () => [] },
    // index: { type: Number, default: 0 },
  },
  emits: ['handleExam'],
  setup(props, { emit }) {
    const handleExam = (value: ExamItem) => {
      emit('handleExam', value);
    };
    return { handleExam };
  },
});
</script>
<style lang="less" scoped></style>
